const BASE_URL = 'xxx'

const LOGIN_BASE_URL = 'xxx'

class FhRequest {
	constructor(baseUrl) {
		this.baseUrl = baseUrl
	}
	request(url, method, params, header = {}) {
		return new Promise((resolve, reject) => {
			wx.request({
				url: this.baseUrl + url,
				method: method,
				header: header,
				data: params,
				success(res) {
					resolve(res.data)
				},
				fail: reject
			})
		})
	}
	get(url, params, header) {
		return this.request(url, 'GET', params, header)
	}
	post(url, data, header) {
		return this.request(url, 'POST', data, header)
	}
}

const loginFhRequest = new FhRequest(LOGIN_BASE_URL)

export default new FhRequest(BASE_URL)

export {
	loginFhRequest
}